<!--
 * @Author: your name
 * @Date: 2021-11-13 14:48:56
 * @LastEditTime: 2021-11-13 15:25:11
 * @LastEditors: Please set LastEditors
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath: /vue-form-json/src/components/form/form.vue
-->
<template>
  <div>
    <slot></slot>
  </div>
</template>
<script>
export default {
  name: 'iForm',
  data() {
    return { fields: [] }
  },
  props: {
    model: { type: Object },
    rules: { type: Object }
  },
  created() {
    this.$on('form-add', field => {
      if (field) this.fields.push(field);
    });
    this.$on('form-remove', field => {
      if (field.prop) this.fields.splice(this.fields.indexOf(field), 1);
    })
  }
}
</script>